package com.xinjie.coursesystem;

import com.xinjie.coursesystem.pojo.Course;
import com.xinjie.coursesystem.pojo.Student;
import com.xinjie.coursesystem.pojo.Teacher;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Description:
 * @author: xinjie.txt
 * @date: 2020/7/22  10:23
 */
public class Main {
	public static void main(String[] args) {


		Course[] courses = new Course[4];
		Student[] students = new Student[4];
			TeacherLoginin();

	}

	public static void TeacherLoginin() {

		List list = new ArrayList();
		list.add(new Teacher());

		Teacher[] teachers = new Teacher[4];
		teachers[0] = new Teacher("T20150102", "张三", "男", 25, 5000, "zs123", "456");
		teachers[0] = new Teacher("T20160135", "李四", "女", 45, 55000, "ls123", "456");
		teachers[0] = new Teacher("T20181009", "王五", "男", 28, 5100, "ww123", "456");

		teachers[0] = new Teacher("T20200207", "赵六", "女", 38, 5120, "zl123", "456");
		List<Teacher> teacherList = new ArrayList<Teacher>();
		for (int i = 0; i < teachers.length; i++) {
			teacherList.add(teachers[i]);
		}


		String teaAccount = null;
		String teaPassword = null;
		Scanner scanner = new Scanner(System.in);

		loop1:
		while (true) {
			System.out.println("输入老师账号");
			teaAccount = scanner.nextLine();
			if (teaAccount == null) {
				System.out.println("输入为空，重新输入：");
				break loop1;
			}
			for (Teacher teacher : teacherList) {
				if (teacher.getTeaAccount().equals(teaAccount)) {
					// 跳出至 loop1
					break loop1;
				}
			}
			// 能到这一步，循环结束也未发现匹配值。
			System.out.println("账号不存在，重新输入：");

		}

		loop2:
		while (true) {
			System.out.println("输入老师密码");
			teaPassword = scanner.nextLine();
			if (teaPassword == null) {
				System.out.println("输入密码为空，重新输入：");
				break loop2;
			}
			for (Teacher teacher : teacherList) {
				if (teacher.getTeaAccount().equals(teaAccount)) {
					if (teaPassword.equals(teacher.getTeaPassword())) {
						System.out.println("登录成功...");
						System.out.println(teacher.toString());
					} else {
						System.out.println("密码输入错误，重新输入： ");
						break;
					}

				}// if
			}// for

		}// while

	}

	void StudentLoginIn() {

	}


}
